﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using Ppt = Microsoft.Office.Interop.PowerPoint;

namespace ObjectModel.PowerPoint.RulesModel
{
    /// <summary>
    /// A PowerPoint chart series object that can resolve itself from serializable info.
    /// </summary>
    public class ResolvableChartSeries : ResolvableObject
    {
        public ResolvableShape Shape { get; set; }
        
        public int SeriesIndex { get; set; }

        //[XmlIgnore]
        //public Ppt.Series Series { get { return base.Resolve() as Ppt.Series; } }

        public ResolvableChartSeries() { } // Parameterless constructor required for serialization.

        public ResolvableChartSeries(Ppt.Shape parent, int index)
        {
            Shape = new ResolvableShape(parent);
            SeriesIndex = index;
        }

        public override object Resolve()
        {
            Ppt.Shape shape = Shape.Resolve() as Ppt.Shape;
            return shape.Chart.SeriesCollection(SeriesIndex);
        }
    }
}
